-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps(cw): regen clients with codegen at 0.25.x #6439
Conversation
|
The [email protected] published Since this is a monorepo which has a single lock file across all clients, the version of client packages need to be updated to Since AWS SDK for JavaScript v3 follows fixed versioning, the |
As there's another codegen client It currently uses old codegen version. |
I pinned the |
I see that you've use exact version Can you use There's no issue with using exact version as it'll be just one version above previous one. |
For a detailed explanation, if you search for
If you use |
I see, thanks for the explanation that makes a lot of sense. I switched it to to be |
I'm glad that versioning issues with Do update your Contributor Guide with learnings from this PR. The AWS SDK for JavaScript team will take a backlog to write a doc on versioning from this experience - possibly in our Developer Guide. We'll get it reviewed from you internally before publishing. |
Tackling I see that you're using 5 dependencies from "@smithy/middleware-retry": "^2.3.1",
"@smithy/protocol-http": "^3.3.0",
"@smithy/service-error-classification": "^2.1.5",
"@smithy/shared-ini-file-loader": "^2.2.8",
"@smithy/util-retry": "^2.2.0", An easy fix would be to copy the same version used by your code generated packages. i.e. "@smithy/middleware-retry": "^3.0.27",
"@smithy/protocol-http": "^4.1.7",
"@smithy/service-error-classification": "^3.0.11", // not direct client dependency, found from package-lock
"@smithy/shared-ini-file-loader": "^3.1.12", // not direct client dependency, found from package-lock
"@smithy/util-retry": "^3.0.10", Since it's the latest major version, you can use "@smithy/middleware-retry": "^3.0.0",
"@smithy/protocol-http": "^4.0.0",
"@smithy/service-error-classification": "^3.0.0",
"@smithy/shared-ini-file-loader": "^3.0.0",
"@smithy/util-retry": "^3.0.0", |
Thanks for the help! I was able to get it building by fixing the smithy versions. The tests are now failing since the code that relied on the older versions of Assuming we can update that code to work with the newer smithy versions, I want to make sure I understand how to avoid this in the future. Here is my understanding of what we had to do to fix this:
Feel free to let me know if I missed any important steps above. Also a few follow up questions:
Thank you again for your help on this issue! This has been a huge headache for us, and its refreshing to see a path out of it. |
yes
yes, but use the highest version you can see that was output by code generation. If code generation output contains:
use
You shouldn't need to specify any
No
Yes. We may publish smithy-typescript maven versions with higher frequency in the future. We may create a dynamic client that accepts a model at runtime in the future, long term.
Sounds like yes.
Yes
use NPM overrides or request a newer release of the code generators.
NPM duplication resolves runtime conflicts of packages needing two different versions of some NPM package. This creates a class of runtime issues relating to inheritance checks but otherwise allows deconfliction. TypeScript is a fictional overlay that is of no concern to the package duplication system. Type errors from duplication are not addressed by it. |
… packages. (#6474) ## Problem The auth code relies on old versions of `@aws-sdk/*` that have since been deprecated or are no longer backward compatible, making versions bumps impossible. - `@aws-sdk/credential-provider-imds` has since been [deprecated](https://www.npmjs.com/package/@aws-sdk/credential-provider-imds) - `fromIni` from `@aws-sdk/credential-provider-ini` no longer supports passing a `loadedConfig`. - `AssumeRoleParams` is no longer exported by `@aws-sdk/credential-provider-ini`. We need to be able to bump these `@aws-sdk/*` package versions to continue to consume newer generated clients. Being pinned to older versions is also a security risk. See #6439 for more information. ## Solution - write custom credentials provider to replace `fromIni` with `loadedConfig` option. - drop dependency on `@aws-sdk/credential-provider-ini` since its no longer used. - add direct dependency on `@aws-sdk/credential-provider-env` since this was installed as part of `@aws-sdk-credential-provider-ini` before. - Fix many (not all) of the deprecation warnings in auth code related to credentials provider. ### Custom Credentials Provider Before, we used `fromIni` with the `loadedConfig` option which allows us to avoid reading the config file from disk on each credentials fetch and allows us to merge the current credentials with those found in the `.ini` file. To achieve the same behavior without the `loadedConfig` option, we need to write our own credentials provider that supports MFA and role assumption, and returns the desired merged credentials, rather than reading from disk. ### Testing - Manually verify this role assumption works by following the steps [here](https://docs.aws.amazon.com/sdkref/latest/guide/access-assume-role.html). - Manually verify MFA works via adapting [this](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-role.html#:~:text=This%20policy%20allows%20the%20user,they%20authenticate%20by%20using%20MFA.&text=Next%2C%20add%20a%20line%20to,by%20the%20role's%20trust%20policy.&text=The%20mfa_serial%20setting%20can%20take,command%20with%20this%20profile%20fails.&text=The%20second%20profile%20entry%2C%20role,%22:%20%5B%20%7B%20...). (Used DuoMobile) - Add unit tests with API calls stubbed. ## Future Work - There are two tests that can now be re-enabled because of this version bump, undoing db27ebb - The steps to test role assumption could become an integ/e2e test. Right now requires setting many resources up in console, but perhaps this can all be done by the SDKs with an account on admin access. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add documentation to the build instructions that these clients must stay in-sync (in terms of codegen).
Add documentation regarding updating @aws-sdk/* packages.
Is that internal documentation? I'm guessing the generator update instructions?
Yes, its internal. Could be worth summarizing it and adding it into the public facing docs at some point. This problem mostly affects developers trying to regenerate the streaming clients, so I think the public use-case is minimal. |
The vsix from the package test is working fine in my VS Code after installation. |
… packages. (aws#6474) The auth code relies on old versions of `@aws-sdk/*` that have since been deprecated or are no longer backward compatible, making versions bumps impossible. - `@aws-sdk/credential-provider-imds` has since been [deprecated](https://www.npmjs.com/package/@aws-sdk/credential-provider-imds) - `fromIni` from `@aws-sdk/credential-provider-ini` no longer supports passing a `loadedConfig`. - `AssumeRoleParams` is no longer exported by `@aws-sdk/credential-provider-ini`. We need to be able to bump these `@aws-sdk/*` package versions to continue to consume newer generated clients. Being pinned to older versions is also a security risk. See aws#6439 for more information. - write custom credentials provider to replace `fromIni` with `loadedConfig` option. - drop dependency on `@aws-sdk/credential-provider-ini` since its no longer used. - add direct dependency on `@aws-sdk/credential-provider-env` since this was installed as part of `@aws-sdk-credential-provider-ini` before. - Fix many (not all) of the deprecation warnings in auth code related to credentials provider. Before, we used `fromIni` with the `loadedConfig` option which allows us to avoid reading the config file from disk on each credentials fetch and allows us to merge the current credentials with those found in the `.ini` file. To achieve the same behavior without the `loadedConfig` option, we need to write our own credentials provider that supports MFA and role assumption, and returns the desired merged credentials, rather than reading from disk. - Manually verify this role assumption works by following the steps [here](https://docs.aws.amazon.com/sdkref/latest/guide/access-assume-role.html). - Manually verify MFA works via adapting [this](https://docs.aws.amazon.com/cli/v1/userguide/cli-configure-role.html#:~:text=This%20policy%20allows%20the%20user,they%20authenticate%20by%20using%20MFA.&text=Next%2C%20add%20a%20line%20to,by%20the%20role's%20trust%20policy.&text=The%20mfa_serial%20setting%20can%20take,command%20with%20this%20profile%20fails.&text=The%20second%20profile%20entry%2C%20role,%22:%20%5B%20%7B%20...). (Used DuoMobile) - Add unit tests with API calls stubbed. - There are two tests that can now be re-enabled because of this version bump, undoing aws@db27ebb - The steps to test role assumption could become an integ/e2e test. Right now requires setting many resources up in console, but perhaps this can all be done by the SDKs with an account on admin access. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
The two streaming clients committed to the repo are generated via different versions of `smithy-typescript-codegen`. Each version of codegen pins the generated client to use specific versions of `@aws-sdk/*` and `@smithy/*` packages. The root project also consumes different versions of these packages. Therefore, the project is currently consuming three different versions of many `@aws-sdk/*` and `@smithy/*` packages. This is problematic because it can cause dependency conflicts. Certain versions of `@aws-sdk/*` and `@smithy/*` packages are only compatible with certain other versions. For more information on this, see the discussion involving help from an SDK team member explaining this problem. - Regenerate both clients with the same version of codegen `0.25.x`. - Pin all necessary versions to ensure a single version of `@aws-sdk/*` and `@smithy/*` packages. - Add documentation to the build instructions that these clients must stay in-sync (in terms of codegen). - Add documentation regarding updating `@aws-sdk/*` packages. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
Problem
The two streaming clients committed to the repo are generated via different versions of
smithy-typescript-codegen
. Each version of codegen pins the generated client to use specific versions of@aws-sdk/*
and@smithy/*
packages. The root project also consumes different versions of these packages. Therefore, the project is currently consuming three different versions of many@aws-sdk/*
and@smithy/*
packages.This is problematic because it can cause dependency conflicts. Certain versions of
@aws-sdk/*
and@smithy/*
packages are only compatible with certain other versions. For more information on this, see the discussion involving help from an SDK team member explaining this problem.Solution
0.25.x
.@aws-sdk/*
and@smithy/*
packages.@aws-sdk/*
packages.feature/x
branches will not be squash-merged at release time.